<!DOCTYPE html>
<input pattern="\d{4}" title="Please specify four digits." value="abc" style="position:absolute; top: 100px">
<script>
document.querySelector('input').setCustomValidity('<script>');
document.querySelector('input').reportValidity();
</script>
